package monitor

import (
	"gin-sns/app/ginframe/router"
	"gin-sns/app/service/middleware/auth"
)

//加载路由
func init() {
	// 服务监控
	g1 := router.New("admin", "/monitor/server", auth.Auth)
	g1.GET("/", "monitor:server:view", ServerController.Server)

	//登陆日志
	g2 := router.New("admin", "/monitor/logininfor", auth.Auth)
	g2.GET("/", "monitor:logininfor:view", LogininforController.List)
	g2.POST("/list", "monitor:logininfor:list", LogininforController.ListAjax)
	g2.POST("/export", "monitor:logininfor:export", LogininforController.Export)
	g2.POST("/clean", "monitor:logininfor:remove", LogininforController.Clean)
	g2.POST("/remove", "monitor:logininfor:remove", LogininforController.Remove)
	g2.POST("/unlock", "monitor:logininfor:unlock", LogininforController.Unlock)

	//操作日志
	g3 := router.New("admin", "/monitor/operlog", auth.Auth)
	g3.GET("/", "monitor:operlog:view", OperlogController.List)
	g3.POST("/list", "monitor:operlog:list", OperlogController.ListAjax)
	g3.POST("/export", "monitor:operlog:export", OperlogController.Export)
	g3.POST("/remove", "monitor:operlog:export", OperlogController.Remove)
	g3.POST("/clean", "monitor:operlog:export", OperlogController.Clean)
	g3.GET("/detail", "monitor:operlog:detail", OperlogController.Detail)

	//在线用户
	g4 := router.New("admin", "/monitor/online", auth.Auth)
	g4.GET("/", "monitor:online:view", OnlineController.List)
	g4.POST("/list", "monitor:online:list", OnlineController.ListAjax)
	g4.POST("/forceLogout", "monitor:online:forceLogout", OnlineController.ForceLogout)
	g4.POST("/batchForceLogout", "monitor:online:batchForceLogout", OnlineController.BatchForceLogout)

	//定时任务
	g5 := router.New("admin", "/monitor/job", auth.Auth)
	g5.GET("/", "monitor:job:view", JobController.List)
	g5.POST("/list", "monitor:job:list", JobController.ListAjax)
	g5.GET("/add", "monitor:job:add", JobController.Add)
	g5.POST("/add", "monitor:job:add", JobController.AddSave)
	g5.GET("/edit", "monitor:job:edit", JobController.Edit)
	g5.POST("/edit", "monitor:job:edit", JobController.EditSave)
	g5.POST("/export", "monitor:job:export", JobController.Export)
	g5.POST("/remove", "monitor:job:remove", JobController.Remove)
	g5.POST("/detailLog", "monitor:job:detail", JobController.DetailLog)
	g5.GET("/detail", "monitor:job:detail", JobController.Detail)
	g5.GET("/jobLog", "monitor:job:view", JobController.LogList)
	g5.POST("/jobLog", "monitor:job:list", JobController.LogListAjax)
	g5.POST("/run", "monitor:job:changeStatus", JobController.Start)
	g5.POST("/start", "monitor:job:changeStatus", JobController.Start)
	g5.POST("/stop", "monitor:job:changeStatus", JobController.Stop)

	//定时任务日志
	g6 := router.New("admin", "/monitor/jobLog", auth.Auth)
	g6.GET("/", "monitor:job:view", JobController.LogList)
	g6.POST("/list", "monitor:job:list", JobController.LogListAjax)
	g6.POST("/export", "monitor:job:export", JobController.Export)
	g6.POST("/remove", "monitor:job:remove", JobController.Remove)
}
